/**
 * 
 */
package com.cr.backbone.util;

import java.util.ArrayList;

import javax.mail.internet.MimeMessage;

import org.springframework.mail.SimpleMailMessage;

import com.cr.backbone.model.SysFile;

/**
 * @project RaedNote
 * @version 1.0
 * @company 
 * @fileType HTMLMessage HTMLMessage.java
 * @author huxh
 * @date 2012-7-3
 */
/**
 * 
 * @author huxh
 * @date 2012-7-3 
 */
public class HTMLMessage{
	private String to;
	private String from;
	private String subject;
	private String text;
	private boolean isHTMl=false;
	private ArrayList<SysFile> files=new ArrayList<SysFile>();//附件
	
	public HTMLMessage() {
	}
	public String getTo() {
		return to;
	}
	public HTMLMessage setTo(String to) {
		this.to = to;
		return this;
	}
	public String getFrom() {
		return from;
	}
	public HTMLMessage setFrom(String from) {
		this.from = from;
		return this;
	}
	public String getSubject() {
		return subject;
	}
	public HTMLMessage setSubject(String subject) {
		this.subject = subject;
		return this;
	}
	public String getText() {
		return text;
	}
	public HTMLMessage setText(String text) {
		this.text = text;
		return this;
	}
	public boolean isHTMl() {
		return isHTMl;
	}
	public HTMLMessage setHTMl(boolean isHTMl) {
		this.isHTMl = isHTMl;
		return this;
	}
	public ArrayList<SysFile> getFiles() {
		return files;
	}
	public void setFiles(ArrayList<SysFile> files) {
		this.files = files;
	}
	
	public HTMLMessage addAtt(SysFile file){
		this.files.add(file);
		return this;	
	}
	
	public SimpleMailMessage getSimpleMailMessage(){
		return UtilsSendMail.getInstance().initSimpleMailMessage(from, to, subject, text);
	}
	
	public MimeMessage getMimeMessage(){
		return UtilsSendMail.getInstance().initMimeMailMessageAndAttachment(from, to, subject, text,files);
	}
}